import { EntitySchema } from '@mikro-orm/core';

export class LeCart {
  id!: string;
  goodsId!: string;
  UID!: string;
  goodsParam!: string;
  goodsNumber: number = 1;
  createdTime!: string;
  updatedTime?: string;
  deletedTime?: string;
  isDeleted: boolean = false;
  goodsName!: string;
  goodsImage!: string;
  showGoodsParam!: string;
}

export const LeCartSchema = new EntitySchema({
  class: LeCart,
  properties: {
    id: { primary: true, type: 'string', columnType: 'bigint' },
    goodsId: { type: 'string', columnType: 'bigint', index: '商品id' },
    UID: { type: 'string', fieldName: 'UID', columnType: 'bigint', index: '用户id' },
    goodsParam: { type: 'string', length: 255 },
    goodsNumber: { type: 'number', default: 1 },
    createdTime: { type: 'string', columnType: 'bigint' },
    updatedTime: { type: 'string', columnType: 'bigint', nullable: true },
    deletedTime: { type: 'string', columnType: 'bigint', nullable: true },
    isDeleted: { type: 'boolean', default: false },
    goodsName: { type: 'string', length: 255 },
    goodsImage: { type: 'string', length: 255 },
    showGoodsParam: { type: 'string', length: 255 },
  },
});
